import request from '@/utils/request'
import store from '@/store/index'
const base = require('../../env/index')

// 夹带k_token
function addK_Token(data) {
    var token = {
        k_token: store.getters.k_token
    }
    Object.assign(data, token)
    return data
}

// 添加课程
export function addCourse(data) {
    return request({
        url: base.classmanagement_url + '/api/v1/admin/lession/save',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}
// 查询课程
export function searchCourse(data) {
    return request({
        url: base.classmanagement_url + '/api/v1/admin/lession/infos',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}
// 删除课程信息
export function deleteCourseById(data) {
    return request({
        url: base.classmanagement_url + '/api/v1/admin/lession/delete/' + data.unid,
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}
// 获取当前行课程信息
export function searchCourseById(data) {
    return request({
        url: base.classmanagement_url + '/api/v1/admin/lession/info/' + data.unid,
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}
// 恢复课程信息
export function recoverCourseByID(data) {
    return request({
        url: base.classmanagement_url + '/api/v1/admin/lession/recover/' + data.unid,
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}
/**
 * 查询教材
 */
export function searchJiaocaiID(data) {
    return request({
        url: base.classmanagement_url + '/api/v1/admin/textbook/getInfos',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}

// 获取老师信息
export function getTeacherAPI(data) {
    return request({
        url: base.classmanagement_url + '/api/v1/admin/clbum/teacher/list/',
        method: 'POST',
        headers: {},
        data: addK_Token(data)
    })
}
